package com.renjiyue.dao;

import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import renjiyue.dao.TeacherMapper;
import renjiyue.pojo.Teacher;
import renjiyue.utils.Mybatisutils;

public class test1 {
    @Test
    public void getTeacher1(){
        SqlSession session = Mybatisutils.getSqlSession();
        TeacherMapper mapper = session.getMapper(TeacherMapper.class);
        for (Teacher teacher : mapper.getTeacher()) {
            System.out.println(teacher);
        }
        session.close();
    }
    @Test
    public void getTeacher2(){
        SqlSession session = Mybatisutils.getSqlSession();
        TeacherMapper mapper = session.getMapper(TeacherMapper.class);
        Teacher teacher1 = mapper.getTeacher1(1);
        System.out.println(teacher1);
        session.close();
    }

    @Test
    public void getTeacher3(){
        SqlSession session = Mybatisutils.getSqlSession();
        TeacherMapper mapper = session.getMapper(TeacherMapper.class);
        Teacher teacher2 = mapper.getTeacher2(1);
        System.out.println(teacher2);
        session.close();
    }
}
